<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<?php
$title = (isset($title) && $title != '') ? $title : 'Chamroeun Microfinance Limited';
$keyword = (isset($keyword) && $keyword != '') ? $keyword : 'Chamroeun Microfinance Limited';
$description = (isset($description) && $description != '') ? $description : 'Chamroeun Microfinance Limited'; 
?>
<title><?php echo $title; ?></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="keywords" content="<?php echo $keyword ; ?>" />
<meta name="title" content="<?php echo $title;?>" />
<meta name="description" content="<?php echo $description; ?>" />
<?php $this->load->view('site/head'); ?>
</head>
<body>
<div id="fb-root"></div>
<script>
//facebook
(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&appId=266431373445843&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

//track visitor
    var visitorGeolocation = new geolocate(false, true, 'visitorGeolocation');
    var ipaddr='';
    var countcode='';
    var countname='';
    var regionname='';
    var cityname='';
    var zipcode='';
    var lat='';
    var longi='';
    var timezone='';
    
    var callback = function(){
                    countcode = visitorGeolocation.getField('countryCode');
                    countname = visitorGeolocation.getField('countryName');
                    ipaddr = visitorGeolocation.getField('ipAddress');
                    regionname = visitorGeolocation.getField('regionName');
                    cityname = visitorGeolocation.getField('cityName');
                    zipcode = visitorGeolocation.getField('zipCode');
                    lat = visitorGeolocation.getField('latitude');
                    longi = visitorGeolocation.getField('longitude');
                    timezone = visitorGeolocation.getField('timeZone');
                    
                    jQuery.ajax({ 
                    	type: "POST", 
                    	url: "/subscriber/trackvisitor", 
                    	data:"ip="+ipaddr+'&ccode='+countcode+"&cname="+countname+"&regname="+regionname+"&cityname="+cityname+"&zipcode="+zipcode+"&lat="+lat+"&longi="+longi+"&timezone="+timezone, 
                    	success:function(response){ 
                    	   console.log(response);
                    	}, 
                    	 error: function(xhr, textStatus, errorThrown) { 
                    		console.log('Error!  Status = ' + xhr.status); 
                    	 } 
                    });
                    
                    console.log('Visitor country code : ' + countcode);
                    console.log('Visitor country name : ' + countname);
                    console.log('Visitor IP address  : ' + ipaddr);
                    console.log('Visitor region name  : ' + regionname);
                    console.log('Visitor city name  : ' + cityname);
                    console.log('Visitor zipcode  : ' + zipcode);
                    console.log('Visitor latitude  : ' + lat);
                    console.log('Visitor longitude   : ' + longi);
                    console.log('Visitor time zone  : ' + timezone);
    };
                   
    visitorGeolocation.checkcookie(callback);
    
</script>

<div id="wrapper">
	<?php $this->load->view('site/header'); ?>
	<?php if (isset($hmenu)){$this->load->view('site/hmenu');} ?>
    <?php //if (isset($banner) && count($banner) > 0){$this->load->view('site/banner');}	?>
	<div id="content-container">
    <?php   
         if(isset($banners) && count($banners)) $this->load->view('site/banner');
         if(isset($pagename) && $pagename !='index') {
            echo '<div id="breadcrumb">';
                $this->load->view('site/breadcrumb');
            echo '</div>';
         }  
    		$margin_left = "";
    		/*if (isset($left)) {
                $classLeft = 'class-left';
                if(isset($content_left) && $content_left == 'report')
                    $classLeft = "class-left-report";
    			echo '<div id="content-left" class="'.$classLeft.'">';
    			$margin_left = "content-margin-left";
    			$this->load->view($left);	
    			echo '</div>'; 
    		}*/
                     
        	$margin_right = "";
    		/*if (isset($right)) {
    			echo '<div id="content-right">';
    			$margin_right = "content-margin-right";
    			$this->load->view('site/content-right');
    			echo '</div>';	
    		}*/
    	?>
        <div id="content-main" class="<?php echo $margin_left.'  '.$margin_right;?>">
		<?php
            $this->load->view($main); 
        ?>
	   </div>
       <div style="clear:both;"></div>
	</div>
    <div id="footer-container">
	   <?php $this->load->view('site/footer'); ?>
    </div>
</div>
</body>
</html>